{% set randomId = random() %}
<tr class='entity' id='parent_{{ randomId }}' aria-label='{{ 'Entry'|trans }}_{{ randomId }}'>

  {# DATE #}
  <td class='item-date'>
    {# checkbox #}
    <input autocomplete='off' type='checkbox' data-action='checkbox-entity' data-id='{{ item.id }}' data-randomid='{{ randomId }}' data-type='{{ Entity.entityType.value }}' aria-label='{{ 'Select'|trans }}' style='width:15px;' />
    {{ item.date|date('Y-m-d') }}
  </td>

  {# TITLE #}
  <td class='title'>
    {# edit icon #}
    {% if not item.locked and (item.userid == App.Users.userData.userid or Entity.entityType.value == 'items' or App.Users.isAdmin) %}
      <a href='{{ Entity.entityType.toPage }}?mode=edit&amp;id={{ item.id }}' class='btn p-2 hl-hover-gray lh-normal border-0 my-n2' title='{{ 'Edit'|trans }}' aria-label='{{ 'Edit'|trans }}'>
        <i class='fas fa-fw fa-pencil-alt'></i>
      </a>
    {% endif %}
    {# lock icon #}
    {% if item.locked %}
      <i class='fas fa-lock fa-fw' style='color:#29AEB9'></i>
    {% endif %}
    {# archived icon #}
    {% if item.state == enum('Elabftw\\Enums\\State').Archived.value %}
      <i class='fas fa-box-archive fa-fw'></i>
    {% endif %}
    {# toggle body #}
    <button class='btn p-2 hl-hover-gray lh-normal border-0 my-n2' data-type='{{ Entity.entityType.value }}' data-id='{{ item.id }}' data-randid={{ randomId }} data-action='toggle-body' data-opened-icon='fa-square-minus' data-closed-icon='fa-square-plus' title='{{ 'Toggle content'|trans }}' aria-label='{{ 'Toggle content'|trans }}'><i class='fas fa-square-plus fa-fw link-like'></i></button>
    {% if item.custom_id %}
      <span class='color-medium' title='{{ 'Custom ID'|trans }}'>{{ item.custom_id }}</span>
    {% endif %}
    <a href='{{ Entity.entityType.toPage }}?mode=view&amp;id={{ item.id }}'>{{ item.title }}</a>
  </td>

  {# NEXT STEP #}
  <td class='item-next'>
    {% set next = '' %}
    {% if item.next_step|length > 0 %}
      {% set stepsArr = item.next_step|split('|') %}
      {% set next = stepsArr|first %}
    {% endif %}
    <span class='item-next-step'>{{ next }}</span>
  </td>

  {# CATEGORY #}
  <td class='item-next'>
    {# timestamp icon #}
    {% if item.timestamped %}
      <i class='far fa-calendar-check mr-1'></i>
    {% endif %}
    {% if item.category %}
      <button type='button' data-action='add-query-filter' data-key='category' data-value='{{ item.category|e('html_attr') }}' class='btn catstat-btn category-btn lh-normal border-0' style='--bg:#{{ item.category_color }}'>{{ item.category_title }}</button>
    {% endif %}
  </td>

  {# STATUS #}
  <td class='item-next'>
    {% if item.status %}
      <button type='button' data-action='add-query-filter' data-key='status' data-value='{{ item.status|e('html_attr') }}' class='btn catstat-btn status-btn lh-normal border-0'><i class='fas fa-circle fa-fw' style='--bg:#{{ item.status_color }}'></i> {{ item.status_title }}</button>
    {% endif %}
  </td>

  {# TAGS #}
  <td class='tags mathjax-ignore'>
  {% set itemtagsArr = tagsArr[item.id] %}
    {% if itemtagsArr|length > 0 %}
      <span class='d-flex flex-wrap'>
        {% for tag in itemtagsArr %}
          <a class='tag margin-1px {{ tag.is_favorite ? 'favorite' }}' href='{{ Entity.entityType.toPage }}?mode=show&amp;tags%5B%5D={{ tag.tag|url_encode }}'>{{ tag.tag }}</a>
        {% endfor %}
      </span>
  {% endif %}
  </td>

  <td class='item-rating'>
    {% if item.rating > 0 %}
      <span class='rating-show rounded p-1'><i class='fas fa-star' title='☻'></i>{{ item.rating }}</span>
    {% endif %}
  </td>

  <td class='item-owner'>
    <button type='button' class='btn lh-normal border-0' style='font-weight:500;' data-action='add-query-filter' data-key='owner' data-value='{{ item.userid }}'>{{ item.fullname }}</button>
  </td>

</tr>
{# container to hold the body of the entity if it is toggled with the +/- icon #}
{# a random id is used because with the favorites the item can appear two times on the page so the old blah_123 doesn't work well #}
<tr hidden id='{{ randomId }}' style='border-left: 4px solid #{{ item.category_color }}'>
  <td colspan='8'>
    <div style='overflow:auto;margin: 10px 0 0 20px'></div>
  </td>
</tr>

{# Perhaps not the most elegant solution, but helps keep the even/odd style of the table, which would be tricky in css #}
<tr hidden><td colspan='7'></td></tr>
